package com.cm.caseManagement.service.impl;


import com.cm.caseManagement.dao.CmCostExpenseMapper;
import com.cm.caseManagement.pojo.entity.CmCostExpense;
import com.cm.caseManagement.service.ICmCostExpenseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cm.caseManagement.utils.DateUtils;

import java.util.List;

/**
 * 费用报销Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-05
 */
@Service
public class CmCostExpenseServiceImpl implements ICmCostExpenseService
{
    @Autowired
    private CmCostExpenseMapper cmCostExpenseMapper;

    /**
     * 查询费用报销
     *
     * @param id 费用报销主键
     * @return 费用报销
     */
    @Override
    public CmCostExpense selectCmCostExpenseById(Long id)
    {
        return cmCostExpenseMapper.selectCmCostExpenseById(id);
    }

    /**
     * 查询费用报销列表
     *
     * @param cmCostExpense 费用报销
     * @return 费用报销
     */
    @Override
    public List<CmCostExpense> selectCmCostExpenseList(CmCostExpense cmCostExpense)
    {
        return cmCostExpenseMapper.selectCmCostExpenseList(cmCostExpense);
    }

    /**
     * 新增费用报销
     *
     * @param cmCostExpense 费用报销
     * @return 结果
     */
    @Override
    public int insertCmCostExpense(CmCostExpense cmCostExpense)
    {
        cmCostExpense.setCreateTime(DateUtils.getNowDate());
        return cmCostExpenseMapper.insertCmCostExpense(cmCostExpense);
    }

    /**
     * 修改费用报销
     *
     * @param cmCostExpense 费用报销
     * @return 结果
     */
    @Override
    public int updateCmCostExpense(CmCostExpense cmCostExpense)
    {
        cmCostExpense.setUpdateTime(DateUtils.getNowDate());
        return cmCostExpenseMapper.updateCmCostExpense(cmCostExpense);
    }

    /**
     * 批量删除费用报销
     *
     * @param ids 需要删除的费用报销主键
     * @return 结果
     */
    @Override
    public int deleteCmCostExpenseByIds(Long[] ids)
    {
        return cmCostExpenseMapper.deleteCmCostExpenseByIds(ids);
    }

    /**
     * 删除费用报销信息
     *
     * @param id 费用报销主键
     * @return 结果
     */
    @Override
    public int deleteCmCostExpenseById(Long id)
    {
        return cmCostExpenseMapper.deleteCmCostExpenseById(id);
    }
}
